define(['artTemplate' , '../../../common/js/lib/text!../../../tpl/line-management.tpl' , '../../../common/js/lib/text!../../../tpl/footer.tpl'] , function(artTemplate , managementTpl , footerTpl) {
  function managementV(data){
    setEl(data);
    //清除定时器
    if(window._time){
      clearInterval(_time);
    };
    function setEl(data){
      var footer = artTemplate.compile(footerTpl)({
            type:2
          }),
          management = artTemplate.compile(managementTpl)(data),
          el = '';
          for(var i=0; i<(4-data.data.length); i++){
            el += '<li>'+
              '<div class="left-box">'+
                '<h3>USB</h3>'+
                '<h3 class="equipment-name">N/A</h3>'+
                '<h3 class="install-state no">未连接</h3>'+
              '</div>'+
              '<div class="right-box no-phone">请连接手机</div>'+
            '</li>'
          };
      $('.webApp-content').html(footer+management);
      $('.list-box').append(el);
      //始终滚动到最下面
      var $ul = $('.right-box ul');
      $ul.each(function(){
        $(this).parent().scrollTop($ul.offset().height - $(this).parent().offset().height)
      });
    };

    (function(){
      window._time = setInterval(function(){
        $.get(interfaces.get_installing_devices.url , function(res){
      		res = JSON.parse(res);
      		if(useNetData){
      			res = res
      		}else{
      			res = res.get_installing_devices;
      		};
      	 	setEl(res);
      	} , 'JSON');
      } , 8000);
    })();
  };
  return managementV;
});
